home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
TDMouse-1.1os.lha
/
TDMouse
/
MouseTest.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-10-06
|
4KB
|
144 lines
/*
// ##########################################################################
// #### ####
// #### TDMouse - A serial mouse driver for the Amiga ####
// #### =============================================== ####
// #### ####
// #### MouseTest.c ####
// #### ####
// #### Version 0.80 -- October 06, 2000 ####
// #### ####
// #### Copyright (C) 1995 Thomas Dreibholz ####
// #### Molbachweg 7 ####
// #### 51674 Wiehl/Germany ####
// #### EMail: Dreibholz@bigfoot.com ####
// #### WWW: http://www.bigfoot.com/~dreibholz ####
// #### ####
// ##########################################################################
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#define EMPTY " "
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct NewWindow nw=
{
160,100,320,85,
0,1,
MOUSEMOVE|MOUSEBUTTONS|CLOSEWINDOW,
RMBTRAP|REPORTMOUSE|WINDOWDEPTH|WINDOWCLOSE|WINDOWDRAG|ACTIVATE|GIMMEZEROZERO,
0L,0L,"MouseTest!",0L,0L,
100,20,640,256,
WBENCHSCREEN
};
struct Window *win;
struct RastPort *rp;
void Print();
void PrintXY();
void PrintButtons();
main()
{
REGISTER BOOL ende;
REGISTER WORD x,y,b;
REGISTER ULONG Class;
REGISTER UWORD Code;
REGISTER UWORD Qualifier;
register struct IntuiMessage *msg;
IntuitionBase=OpenLibrary("intuition.library",0L);
GfxBase=OpenLibrary("graphics.library",0L);
if((IntuitionBase==NULL)||(GfxBase==NULL)) exit(0);
win=OpenWindow(&nw);
if(win!=NULL)
{
rp=win->RPort;
Print(15,10,"Maus bewegen!");
Print(15,25,"Maustasten:");
ende=FALSE;
do
{
b=0;
WaitPort(win->UserPort);
msg=GetMsg(win->UserPort);
Class=msg->Class;
Code=msg->Code;
Qualifier=msg->Qualifier;
x=msg->MouseX;
y=msg->MouseY;
ReplyMsg(msg);
switch(Class)
{
case MOUSEMOVE:
PrintXY(x,y);
PrintButtons(Qualifier);
break;
case MOUSEBUTTONS:
PrintXY(x,y);
PrintButtons(Qualifier);
break;
case CLOSEWINDOW:
ende=TRUE;
break;
}
}
while(ende==FALSE);
CloseWindow(win);
}
else
puts("FEHLER: Kann Fenster nicht öffnen!");
CloseLibrary(GfxBase);
CloseLibrary(IntuitionBase);
exit(0);
}
void Print(x,y,text)
UWORD x,y;
UBYTE *text;
{
Move(rp,x,y);
Text(rp,text,strlen(text));
}
void PrintXY(x,y)
WORD x,y;
{
UBYTE buffer[40];
sprintf(&buffer,"X=%4d Y=%4ld",x,y);
Print(15,10,&buffer);
}
void PrintButtons(qualifier)
UWORD qualifier;
{
REGISTER BYTE l,r,m;
l=r=m=0;
if(qualifier & IEQUALIFIER_LEFTBUTTON) l=1;
if(qualifier & IEQUALIFIER_RBUTTON) r=1;
if(qualifier & IEQUALIFIER_MIDBUTTON) m=1;
if(l) Print(130,25,"Linke Maustaste"); else Print(130,25,EMPTY);
if(m) Print(130,40,"Mittlere Maustaste"); else Print(130,40,EMPTY);
if(r) Print(130,55,"Rechte Maustaste"); else Print(130,55,EMPTY);
}